<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
  <head>
    <title>JsUnit test page for file xslt.js of goog-ajaxslt</title>
    <script language="JavaScript" type="text/javascript" 
    src="jsunit/app/jsUnitCore.js"></script>
    <script language="JavaScript" type="text/javascript" 
    src="xmltoken.js"></script>
    <script language="JavaScript" type="text/javascript" 
    src="util.js"></script>
    <script language="JavaScript" type="text/javascript" 
    src="dom.js"></script>
    <script language="JavaScript" type="text/javascript" 
    src="xpath.js"></script>
    <script language="JavaScript" type="text/javascript" 
    src="xslt.js"></script>
    <script language="JavaScript" type="text/javascript" 
    src="xslt_unittest.js"></script>
  </head>
  
  <body>
    This is a <a href="http://www.jsunit.net/">jsUnit</a> test
    page. Run it using the <a
    href="jsunit/testRunner.html">jsUnit runner</a>.

    <!-- used in the test cases -->

<textarea id="xml">
  <all>
    <item pos="2">A</item>
    <item pos="3">B</item>
    <item pos="1">C</item>
  </all>
</textarea>

<textarea id="xslt-for-each-sort">
  <xsl:stylesheet>
    <xsl:template match="/">
      <xsl:for-each select="//item">
        <xsl:sort select="@pos"/>
        <xsl:value-of select="."/>
      </xsl:for-each>
    </xsl:template>
  </xsl:stylesheet>
</textarea>

<textarea id="xslt-for-each-sort-ascending">
  <xsl:stylesheet>
    <xsl:template match="/">
      <xsl:for-each select="//item">
        <xsl:sort select="." order="ascending"/>
        <xsl:value-of select="."/>
      </xsl:for-each>
    </xsl:template>
  </xsl:stylesheet>
</textarea>

<textarea id="xslt-for-each-sort-descending">
  <xsl:stylesheet>
    <xsl:template match="/">
      <xsl:for-each select="//item">
        <xsl:sort select="." order="descending"/>
        <xsl:value-of select="."/>
      </xsl:for-each>
    </xsl:template>
  </xsl:stylesheet>
</textarea>

<textarea id="xml-apply-templates">
  <all>
    <item type="X">A</item>
    <item type="Y">B</item>
    <item type="X">C</item>
  </all>
</textarea>

<textarea id="xslt-apply-templates">
  <xsl:stylesheet>
    <xsl:template match="/">
      <xsl:apply-templates select="//item"/>
    </xsl:template>
    <xsl:template match="item[@type='X']">
      <xsl:value-of select="."/>
    </xsl:template>
    <xsl:template match="item[@type='Y']">
      <xsl:value-of select="."/>
    </xsl:template>
  </xsl:stylesheet>
</textarea>

<textarea id="xslt-global-variables">
  <xsl:stylesheet>
    <xsl:variable name="x" select="'x'"/>
    <xsl:variable name="y" select="'y'"/>
    <xsl:variable name="z">
      <xsl:text>z</xsl:text>
    </xsl:variable>
    <xsl:template match="/">
      <xsl:value-of select="$x"/>
      <xsl:value-of select="$z"/>
      <xsl:for-each select="//item">
        <xsl:value-of select="$y"/>
      </xsl:for-each>
    </xsl:template>
  </xsl:stylesheet>
</textarea>

<textarea id="xslt-top-level-output">
  <xsl:stylesheet>
    <xsl:template match="/">
      <xsl:element name="x">
        <xsl:attribute name="y">
          <xsl:text>z</xsl:text>
        </xsl:attribute>
        <xsl:text>k</xsl:text>
      </xsl:element>
    </xsl:template>
  </xsl:stylesheet>
</textarea>

<textarea id="xslt-copy">
  <xsl:stylesheet>
    <xsl:template match="/">
      <xsl:for-each select="//item">
        <xsl:copy>
          <xsl:for-each select="@*|node()">
            <xsl:copy/>
          </xsl:for-each>
        </xsl:copy>
      </xsl:for-each>
    </xsl:template>
  </xsl:stylesheet>
</textarea>

  </body>
</html>
